<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="/css/common.css">


    <link rel="stylesheet" href="/layui/extend/dtree.css">
    <link rel="stylesheet" href="/layui/extend/font/dtreefont.css">
    <link rel="stylesheet" href="/layui/extend/formSelects-v4.css">
</head>
<!--<body>-->
<!--    <div class="yadmin-body animated fadeIn">-->
<!--        <form action="" id="user-edit-form" method="post" class="layui-form layui-form-pane" lay-filter="user-edit-form">-->
<!--            <div class="layui-form-item">-->
<!--                <label for="username" class="layui-form-label">-->
<!--                    用户名-->
<!--                </label>-->
<!--                <div class="layui-input-block">-->
<!--                    <input type="text" id="username" name="username"-->
<!--                           lay-verify="required" lay-vertype="tips"-->
<!--                           autocomplete="off" class="layui-input">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label for="email" class="layui-form-label">-->
<!--                    邮箱-->
<!--                </label>-->
<!--                <div class="layui-input-block">-->
<!--                    <input type="text" id="email" name="email"-->
<!--                           autocomplete="off" class="layui-input">-->
<!--                </div>-->
<!--            </div>-->
<!--            &lt;!&ndash; 编辑时不显示密码框 &ndash;&gt;-->
<!--            <div class="layui-form-item">-->
<!--                <label for="password" class="layui-form-label">-->
<!--                    用户密码-->
<!--                </label>-->
<!--                <div class="layui-input-block">-->
<!--                    <input type="password" id="password" name="password"-->
<!--                           lay-verify="required" lay-vertype="tips"-->
<!--                           autocomplete="off" class="layui-input">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item" pane="">-->
<!--                <label class="layui-form-label">-->
<!--                    状态-->
<!--                </label>-->
<!--                <div class="layui-input-block">-->
<!--                    <input type="radio" name="status" value="1" title="正常" checked="checked">-->
<!--                    <input type="radio" name="status" value="0" title="锁定">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label">-->
<!--                    角色-->
<!--                </label>-->
<!--                <div class="layui-input-block">-->
<!--                    <select name="role" xm-select="role-select"-->
<!--                            lay-verify="required"-->
<!--                            lay-vertype="tips">-->
<!--                        <option value="">请选择角色</option>-->
<!--                        <option value="1">管理员</option>-->
<!--                        <option value="2">普通用户</option>-->
<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label">-->
<!--                    部门-->
<!--                </label>-->
<!--                <div class="layui-input-block">-->
<!--                    <ul id="deptTree" class="dtree" data-id="0" data-value="请选择部门"></ul>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <div class="layui-input-block" style="margin-left:0;text-align:center;">-->
<!--                    <input type="hidden" id="deptId" name="deptId" value="">-->
<!--                    <input type="hidden" id="userId" name="userId" value="">-->
<!--                    <button class="layui-btn layui-btn-normal btn-w100" lay-submit="" lay-filter="add">增加</button>-->
<!--                </div>-->
<!--            </div>-->
<!--        </form>-->
<!--&lt;!&ndash;        <table class="layui-hide" id="user-table"></table>&ndash;&gt;-->
<!--    </div>-->

<!--    <script src="/layui/layui.js"></script>-->
<!--    <script src="/js/common.js"></script>-->

<!--    <script>-->
<!--        layui.config({-->
<!--            base: '/layui/extend/'-->
<!--        }).extend({-->
<!--            formSelects: 'formSelects-v4'-->
<!--        }).use(['table','form', 'layer', 'formSelects', 'dtree','tablePlug'], function () {-->
<!--            $ = layui.jquery;-->
<!--            var form = layui.form-->
<!--                , layer = layui.layer-->
<!--                , formSelects = layui.formSelects-->
<!--                , dtree = layui.dtree-->
<!--                ,table = layui.table,-->
<!--                tablePlug=layui.tablePlug;-->
<!--            tablePlug.smartReload.enable(true);-->

<!--            dtree.renderSelect({-->
<!--                elem: "#deptTree",-->
<!--                url: "/data/dept/tree.json",-->
<!--                dataStyle: "layuiStyle",-->
<!--                width: "100%",-->
<!--                method: "GET",-->
<!--                dot: false,-->
<!--                accordion: true,-->
<!--                menubar: true,-->
<!--                response: {-->
<!--                    statusCode: 0,-->
<!--                    message: "msg",-->
<!--                    treeId: "id",-->
<!--                    parentId: "parentId",-->
<!--                    title: "name"-->
<!--                }-->
<!--            });-->

<!--            dtree.on("node('deptTree')" ,function(obj){-->
<!--                $("#deptId").val(obj.param.nodeId);-->
<!--            });-->

<!--            form.on('submit(add)', function (form) {-->
<!--                form.field.role = formSelects.value('role-select', 'val');-->
<!--                layer.msg("添加成功", {icon: 6});-->
<!--                return false;-->
<!--            });-->
<!--            // form.render({-->
<!--            //     elem: '#user-edit-form',-->
<!--            //     url: '/testaaa',-->
<!--            //     page: true,-->
<!--            //     toolbar: '#toolbar',-->
<!--            //     smartReloadModel: true,-->
<!--            //     cols: [-->
<!--            //         [-->
<!--            //             {type:'checkbox'},-->
<!--            //             {type: 'numbers', title: '序号', width: 60},-->
<!--            //             {field: 'userId', title: 'ID', hide: true},-->
<!--            //             {field: 'username', title: '用户名', minWidth: 160},-->
<!--            //             {field: 'deptName', title: '部门', minWidth: 160},-->
<!--            //             {field: 'email', title: '邮箱', minWidth: 160},-->
<!--            //             {field: 'createTime', title: '创建时间', align: 'center', width: 180},-->
<!--            //             {field: 'lastLoginTime', title: '最后登陆时间',align: 'center', width: 180},-->
<!--            //             {field: 'status', title: '状态', align: 'center', templet: "#statusTpl", width: 100}-->
<!--            //         ]-->
<!--            //     ]-->
<!--            // });-->
<!--            form.val("user-edit-form",{"userId": 1,-->
<!--                "username": "张三",-->
<!--                "email": "root@zhaojun.im",-->
<!--                "status": "1",-->
<!--                "lastLoginTime": "2019-07-06 18:40:34",-->
<!--                "createTime": "2018-12-02 07:30:52",-->
<!--                "deptId": 1,-->
<!--                "deptName": "开发部"});-->
<!--        });-->
<!--    </script>-->

<!--</body>-->
<body>
<form class="layui-form" action="">
    <input type="hidden" name="id" value="${entity.id}" />
    <input type="hidden" name="url" value="${entity.url}" />
    <div class="backgroundf addwrap">
        <div class="layui-form">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">序号</label>
                    <div class="layui-input-block">
                        <input type="text" name="xh" required  lay-verify="required" placeholder="请输入序号" autocomplete="off" value="${entity.xh}"  class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">分类</label>
                    <div class="layui-input-inline" style="margin-left: 5px">
                        <select name="flid" id="flid" lay-filter="aihao" >
                            <option value=""></option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="flex flex-jusity-betreen">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">pym</label>
                        <div class="layui-input-block">
                            <input type="text" name="pym" required  lay-verify="required" autocomplete="off" class="layui-input" value="${entity.pym}" >
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">废除</label>
                        <div class="layui-input-block" style="margin-top: -8px">
                            <input type="radio" name="cancel" value="true" title="是">
                            <input type="radio" name="cancel" value="false" title="否" checked="">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input type="text" name="mc" required  lay-verify="required" placeholder="请输入名称" autocomplete="off" value="${entity.mc}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">代码</label>
                <div class="layui-input-block">
                    <input type="text" name="dm" required  lay-verify="required" placeholder="请输入代码" autocomplete="off" value="${entity.dm}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <input type="text" name="bz" autocomplete="off" class="layui-input" value="${entity.bz}">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="flex flex-jusity-around tjbtn">
                    <button class="layui-btn layui-btn-radius layui-btn-sm layui-btn-primary qx">取消</button>
                    <button class="layui-btn layui-btn-radius layui-btn-sm " lay-submit lay-filter="formDemoadd">保存</button>
                    //提交按钮都需天机lay-submit属性
                </div>
            </div>
        </div>
    </div>
</form>
    <script src="/layui/layui.js"></script>
    <script src="/js/common.js"></script>

<script>
    layui.use('form', function() {
        var form = layui.form;
        //单选按钮值回显
        $(":radio[name='cancel'][value='" + ${entity.cancel} + "']").prop('checked', true);

        //下拉框值
        $.ajax({
            url: '/Metadatafl/tocalssList',
            dataType: 'json',
            type: 'get',
            success: function (data) {
                $.each(data.list, function (index, item) {
                    $('#flid').append(new Option(item.mc, item.id));// 下拉菜单里添加元素
                    var flid='${entity.flid}';
                    $("#flid").val(flid);//下拉框值回显
                });
                layui.form.render("select");
            }
        })

        //按钮添加属性lay-filter="formDemoadd"
        form.on('submit(formDemoadd)', function (data) {
            // alert(JSON.stringify(data.field))
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            // data.field.shstate = 1;
            $.ajax({
                url: '/Metadatafledit/businessave',
                method:'post',
                data: data.field,
                dataType:'JSON',
                success: function (data) {
                    alert(data.msg)
                    parent.layer.close(index);
                    window.parent.searchBtn();
                }

            });
            return false;
        });
    });
    /*点击取消*/
    $('.qx').on('click',function(){
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        //console.log(index)
        parent.layer.close(index);
    })

</script>
</body>

</html>